using System;
using System.Configuration;
using System.Web.Configuration;

namespace ObjectRelationalMapping.Configuration
{
    public class MappingSection : ConfigurationSection
    {
        [ConfigurationProperty ( "ApplicationNamespace" )]
        public string ApplicationNamespace
        {
            get { return ( string )this[ "ApplicationNamespace" ]; }
        }

        [ConfigurationProperty ( "DatabaseConnectionString" )]
        public string DatabaseConnectionString
        {
            get { return ( string )this[ "DatabaseConnectionString" ]; }
        }

        [ConfigurationProperty ( "ExcludePrefix" )]
        public string ExcludePrefix
        {
            get { return ( string )this[ "ExcludePrefix" ]; }
        }

        [ConfigurationProperty ( "ExcludeTable" )]
        public string ExcludeTable
        {
            get { return ( string )this[ "ExcludeTable" ]; }
        }

        [ConfigurationProperty ( "ExecuteGeneratedSql" )]
        public bool ExecuteGeneratedSql
        {
            get 
            {
                bool result = false;

                try
                {
                    result = Convert.ToBoolean ( this[ "ExecuteGeneratedSql" ] );
                }
                catch { }

                return result;
            }
        }
    }
}